#ifndef _ENTITY_
#define _ENTITY_

#include <cmath>
#include "Types.hpp"
#include "BaseObject.hpp"
#include "Content/Map.hpp"

/** 
* Basic game entity.
*/
class Entity:public BaseObject{
public:

    /** X Location */
    float x;
    /**  Y Location */
    float y;

    /** Collision box offsets. */
    byte cxOffset, cyOffset;
    
    /** Collision box size. */
    byte cWidth, cHeight;

    /** Last time the entity was updated through networking. */
	unsigned int lastNetworkUpdateTime;
    
    /** Direction of entity movement. Directions are bit flags. */
    enum Direction{
        /** North */
        dir_N = 1,
        /** East */
        dir_E = 2,
        /** South */
        dir_S = 4,
        /** West */
        dir_W = 8,
        /** Not actual direction, used to check if entity is moving vertically. */
        dir_Vertical = 5,
        /** Not actual direction, used to check if entity is moving horizontally. */
        dir_Horizontal = 10
    };

    /** The direction the entity is moving. 0 means no movement */
    byte direction;

	float velocityX, velocityY;
	float maxVelocityX, maxVelocityY;
	float acceleration;

    /** Is the entity moving. */
    bool moving;

	Entity();
	Entity(float entityX, float entityY);
	
	void setCollisionBox(byte xf, byte yf, byte w, byte h);
    virtual void setMove(byte dir);
    virtual void move();
    virtual void moveX();
    virtual void moveY();
};

#endif
